package com.zhengjiang.lambda;

import javax.swing.*;

/**
 * @author zhengjiang
 * @version 1.0.0
 * @description 构造器引用
 * @date 2021/5/30
 **/
public class ConstructRefer {

    public static void main(String[] args) {

        //1.
        YourTest yt = title -> new JFrame(title);
        JFrame jf = yt.win("test");
        jf.show();

        //2.
        yt = JFrame::new;
        JFrame jf1 = yt.win("MyJFrame");
        jf1.show();

    }
}

@FunctionalInterface
interface YourTest {
    JFrame win(String title);
}
